package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbSjkqgl;
import com.ruoyi.tjbb.service.ISysTjbbSjkqglService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 司机考勤管理Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/sjcx/sjkqgl")
public class SysTjbbSjkqglController extends BaseController
{
    @Autowired
    private ISysTjbbSjkqglService sysTjbbSjkqglService;

    /**
     * 查询司机考勤管理列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbSjkqgl sysTjbbSjkqgl)
    {
        startPage();
        List<SysTjbbSjkqgl> list = sysTjbbSjkqglService.selectSysTjbbSjkqglList(sysTjbbSjkqgl);
        return getDataTable(list);
    }

    /**
     * 导出司机考勤管理列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:export')")
    @Log(title = "司机考勤管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbSjkqgl sysTjbbSjkqgl)
    {
        List<SysTjbbSjkqgl> list = sysTjbbSjkqglService.selectSysTjbbSjkqglList(sysTjbbSjkqgl);
        ExcelUtil<SysTjbbSjkqgl> util = new ExcelUtil<SysTjbbSjkqgl>(SysTjbbSjkqgl.class);
        util.exportExcel(response, list, "司机考勤管理数据");
    }

    /**
     * 获取司机考勤管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbSjkqglService.selectSysTjbbSjkqglById(id));
    }

    /**
     * 新增司机考勤管理
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:add')")
    @Log(title = "司机考勤管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbSjkqgl sysTjbbSjkqgl)
    {
        return toAjax(sysTjbbSjkqglService.insertSysTjbbSjkqgl(sysTjbbSjkqgl));
    }

    /**
     * 修改司机考勤管理
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:edit')")
    @Log(title = "司机考勤管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbSjkqgl sysTjbbSjkqgl)
    {
        return toAjax(sysTjbbSjkqglService.updateSysTjbbSjkqgl(sysTjbbSjkqgl));
    }

    /**
     * 删除司机考勤管理
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:sjkqgl:remove')")
    @Log(title = "司机考勤管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbSjkqglService.deleteSysTjbbSjkqglByIds(ids));
    }
}
